import numpy as np
import pandas as pd
import matplotlib as mtlb


def test():
    print 'test'
    s = pd.Series([1, 3, 5, np.nan, 6, 8])
    # print s
    dates = pd.date_range('20130101', periods=6)
    # print dates
    df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list('XBCD'))
    # print df
    df2 = pd.DataFrame({'A': 1.,
                        'B': pd.Timestamp('20130102'),
                        'C': pd.Series(1, index=list(range(4)), dtype='float32'),
                        'D': np.array([3] * 4, dtype='int32'),
                        'E': pd.Categorical(["test", "train", "test", "train"]),
                        'F': 'foo'})
    # print df2.dtypes
    # print df.head(2)
    # print df.tail(2)
    print df
    print df.describe()
    print df.T
    print df['X']
    print df[df.X > 0]
    # df.head(2).to_csv('fo.csv')
    df.to_excel('foo.xlsx', sheet_name='Sheet1')


def test2():
    ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
    print ts


def test_join():
    dt1 = pd.DataFrame({'A': 5.,
                        'E': 'dsdds',
                        'F': 'foo'},
                       index=[0, 1]
                       )
    dt2 = pd.DataFrame({'A': 8.,
                        'E': 'sss',
                        'F': 'disk'},
                       index=[2, 3]
                       )
    ff = [dt1, dt2]
    result = pd.concat(ff)
    print result


if __name__ == '__main__':
    test_join()
